package didi.hcp.consumer.controller;

import didi.hcp.api.HelloService;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLOutput;

@RestController
@RequestMapping
public class ConsumerController {


    @Reference(version = "1.0.0",check = false)
    HelloService helloService;

    @GetMapping("/sayHello")
    public String test(String str){
        RpcContext.getContext().setAttachment("name",str);
        System.out.println("Consumer | str="+str);
        String res = helloService.sayHello(str);
        return res;
    }

}
